package oj;

public class Num108 {
    public TreeNode sortedArrayToBST(int[] nums) {
        return sort(nums,0,nums.length,nums.length/2);
    }

    public TreeNode sort(int[] nums,int left,int right,int mid){
        if(left>=right){
            return null;
        }
        TreeNode root=new TreeNode(nums[mid]);
        root.left= sort(nums,left,mid,(left+mid)/2);
        root.right=sort(nums,mid+1,right,(mid+1+right)/2);
        return root;
    }
}
